package cn.sh.yhk.mapper.basic;

import cn.sh.yhk.model.basic.STaskScheduleJob;
import cn.sh.yhk.model.basic.STaskScheduleJobExample;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

@Mapper
public interface STaskScheduleJobMapper {
    @SelectProvider(type = STaskScheduleJobSqlProvider.class, method = "countByExample")
    long countByExample(STaskScheduleJobExample example);

    @DeleteProvider(type = STaskScheduleJobSqlProvider.class, method = "deleteByExample")
    int deleteByExample(STaskScheduleJobExample example);

    @Insert({
            "insert into s_task_schedule_job (id, create_at, ",
            "cron_time, full_entity, ",
            "role_name, name, ",
            "status, update_at)",
            "values (#{id,jdbcType=INTEGER}, #{createAt,jdbcType=TIMESTAMP}, ",
            "#{cronTime,jdbcType=VARCHAR}, #{fullEntity,jdbcType=VARCHAR}, ",
            "#{groupName,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, ",
            "#{status,jdbcType=INTEGER}, #{updateAt,jdbcType=TIMESTAMP})"
    })
    int insert(STaskScheduleJob record);

    @InsertProvider(type = STaskScheduleJobSqlProvider.class, method = "insertSelective")
    int insertSelective(STaskScheduleJob record);

    @SelectProvider(type = STaskScheduleJobSqlProvider.class, method = "selectByExample")
    @Results({
            @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER),
            @Result(column = "create_at", property = "createAt", jdbcType = JdbcType.TIMESTAMP),
            @Result(column = "cron_time", property = "cronTime", jdbcType = JdbcType.VARCHAR),
            @Result(column = "full_entity", property = "fullEntity", jdbcType = JdbcType.VARCHAR),
            @Result(column = "role_name", property = "groupName", jdbcType = JdbcType.VARCHAR),
            @Result(column = "name", property = "name", jdbcType = JdbcType.VARCHAR),
            @Result(column = "status", property = "status", jdbcType = JdbcType.INTEGER),
            @Result(column = "update_at", property = "updateAt", jdbcType = JdbcType.TIMESTAMP)
    })
    List<STaskScheduleJob> selectByExample(STaskScheduleJobExample example);

    @UpdateProvider(type = STaskScheduleJobSqlProvider.class, method = "updateByExampleSelective")
    int updateByExampleSelective(@Param("record") STaskScheduleJob record, @Param("example") STaskScheduleJobExample example);

    @UpdateProvider(type = STaskScheduleJobSqlProvider.class, method = "updateByExample")
    int updateByExample(@Param("record") STaskScheduleJob record, @Param("example") STaskScheduleJobExample example);
}